package com.sunmi.usercenter.controller;

import com.sunmi.usercenter.utils.ThreadPoolManager;

import android.app.Activity;
import android.content.Context;


public abstract class SuperController {

	/**
	 * 上下文
	 */
	public Context mContext;
	/**
	 * activity
	 */
	public Activity mActivity;
	/**
	 * 线程池
	 */
	public ThreadPoolManager mThreadPoolManager;

	public SuperController(Context mContext) {
		this.mContext = mContext;
		mActivity = (Activity) mContext;
		mThreadPoolManager = ThreadPoolManager.getInstance();
	}

	/**
	 * UI线程执行一个任务
	 * 
	 * @param run
	 */
	public void runOnUI(Runnable run) {
		mActivity.runOnUiThread(run);
	}

	/**
	 * 子线程运行
	 * 
	 * @param run
	 */
	public void executeTask(Runnable run) {
		mThreadPoolManager.executeTask(run);
	}
}
